//
//  DockItem.m
//  SinaWeibo
//
//  Created by zouyb on 13-10-20.
//  Copyright (c) 2013年 zouyb. All rights reserved.
//

#import "DockItem.h"
#define kImagePart 0.5

@implementation DockItem

- (id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.titleLabel.font = [UIFont systemFontOfSize:14];
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.imageView.contentMode = UIViewContentModeScaleAspectFit;
        self.imageView.layer.cornerRadius = 6.0;
        self.imageView.layer.masksToBounds = YES;
        self.adjustsImageWhenHighlighted = NO;
        [self setTitleColor:[UIColor colorWithHexString:@"666666"] forState:UIControlStateNormal];
        [self setTitleColor:[UIColor colorWithHexString:@"666666"] forState:UIControlStateSelected];
    }
    return self;
}

- (CGRect)titleRectForContentRect:(CGRect)contentRect
{
    CGFloat titleY = self.frame.size.height * kImagePart;
    CGRect frame = CGRectMake(0, titleY+5, self.frame.size.width, self.frame.size.height - titleY-15);
    return frame;
}

- (CGRect)imageRectForContentRect:(CGRect)contentRect
{
//    CGRect frame = CGRectMake(15, 15, self.frame.size.width-30, self.frame.size.height * kImagePart - 15);
    
    CGRect frame = CGRectMake((self.frame.size.width-50)*0.5, (self.frame.size.height-50)*0.5*kImagePart, 50, 50);
    return frame;
}

- (void)setHighlighted:(BOOL)highlighted
{
    
}


@end
